package com.thoughtworks.preuniversityprogram.biblioteca;

import java.util.List;

/**
 * Created by padmavb on 6/10/14.
 */
public class Return extends Library {


    public List<Book> returnBook(String bookToReturn,List<Book> checkOutBookObjects) {

        int index;
        int flag=0;

        for(index=0;index<checkOutBookObjects.size();index++){

            if(bookToReturn.equals(checkOutBookObjects.get(index).getTitle())){
                System.out.print("Thank you for returning the book\n");
                checkOutBookObjects.remove(checkOutBookObjects.get(index));
                flag=1;
                break;
            }

        }
        if(flag==0)
            System.out.print("That is not a valid book to return\n");
        return checkOutBookObjects;

    }
}
